/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "stockproducto")
@NamedQueries({
    @NamedQuery(name = "Stockproducto.findAll", query = "SELECT s FROM Stockproducto s"),
    @NamedQuery(name = "Stockproducto.findByIdStock", query = "SELECT s FROM Stockproducto s WHERE s.idStock = :idStock"),
    @NamedQuery(name = "Stockproducto.findByCantidadStock", query = "SELECT s FROM Stockproducto s WHERE s.cantidadStock = :cantidadStock"),
    @NamedQuery(name = "Stockproducto.findByProducto", query = "SELECT s FROM Stockproducto s WHERE s.producto = :producto"),
    @NamedQuery(name = "Stockproducto.findByFechaHoraStock", query = "SELECT s FROM Stockproducto s WHERE s.fechaHoraStock = :fechaHoraStock")})
public class Stockproducto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idStock")
    private Integer idStock;
    @Basic(optional = false)
    @Column(name = "cantidadStock")
    private double cantidadStock;
    @Basic(optional = false)
    @Column(name = "fechaHoraStock")
    private String fechaHoraStock;
    @JoinColumn(name = "idProducto", referencedColumnName = "idProducto")
    @ManyToOne(optional = false)
    private Producto producto;
    @OneToMany(mappedBy = "stockproducto")
    private Collection<Detallerecepcion> detallerecepcionCollection;

    public Stockproducto() {
    }

    public Stockproducto(Integer idStock) {
        this.idStock = idStock;
    }

    public Stockproducto(Integer idStock, double cantidadStock, String fechaHoraStock) {
        this.idStock = idStock;
        this.cantidadStock = cantidadStock;
        this.fechaHoraStock = fechaHoraStock;
    }

    public Integer getIdStock() {
        return idStock;
    }

    public void setIdStock(Integer idStock) {
        this.idStock = idStock;
    }

    public double getCantidadStock() {
        return cantidadStock;
    }

    public void setCantidadStock(double cantidadStock) {
        this.cantidadStock = cantidadStock;
    }

    public String getFechaHoraStock() {
        return fechaHoraStock;
    }

    public void setFechaHoraStock(String fechaHoraStock) {
        this.fechaHoraStock = fechaHoraStock;
    }

    public Producto getProducto() {
        return producto;
    }

    public void setProducto(Producto producto) {
        this.producto = producto;
    }

    public Collection<Detallerecepcion> getDetallerecepcionCollection() {
        return detallerecepcionCollection;
    }

    public void setDetallerecepcionCollection(Collection<Detallerecepcion> detallerecepcionCollection) {
        this.detallerecepcionCollection = detallerecepcionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStock != null ? idStock.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stockproducto)) {
            return false;
        }
        Stockproducto other = (Stockproducto) object;
        if ((this.idStock == null && other.idStock != null) || (this.idStock != null && !this.idStock.equals(other.idStock))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Stockproducto[idStock=" + idStock + "]";
    }

}
